package project.movieMap.baseLib.beans;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.*;
import java.util.HashSet;

@Data
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Movie {
    //实例化电影必须有名称
    @JsonCreator
    public Movie(@JsonProperty("name") String name) {
        this.name = name;
    }
    //电影ID
    private int Id;
    //电影名称
    private String name;
    //电影年份
    private int year;
    //导演,名称之间用/隔开,如: 鲍勃·佩尔西凯蒂 / 彼得·拉姆齐 / 罗德尼·罗斯曼
    private String director;
    //编剧,名称之间用/隔开
    private String screenWriter;
    //主演,名称之间用/隔开
    private String performer;
    //类型,名称之间用/隔开
    private String type;
    //制片国家和地区,名称之间用/隔开
    private String nation;
    //语言,名称之间用/隔开
    private String language;
    //上映日期,各时间之间用/隔开,如:2018-12-21(中国大陆) / 2018-12-14(美国)
    private String releaseDate;
    //片长
    private String filmLength;
    //剧情简介
    private String synopsis;
    //电影评分
    private float rating;
    //评价人数
    private int ratedCount;
    //电影剧照URL
    private HashSet<String> stagePhotosURL = new HashSet<>();
    //相关的地理位置信息ID,存数据库时经行序列化
    private HashSet<Integer> geoInfoIds = new HashSet<>();
    //相关的回复信息ID,存数据库时经行序列化
    private HashSet<Integer> commentIds = new HashSet<>();

    public void addStagePhotoURL(String url) {
        stagePhotosURL.add(url);
    }
    public void removeStagePhotoURL(String url) {
            stagePhotosURL.remove(url);
    }
    public void addGeoInfoIds(int Id) {
        geoInfoIds.add(Id);
    }
    public void removeGeoInfoId(int Id) {
            geoInfoIds.remove(Id);
    }
    public void addCommentId(int Id) {
        commentIds.add(Id);
    }
    public void removeCommentId(int Id) {
            commentIds.remove(Id);
    }
}
